#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package};

import javax.sql.DataSource;
import org.skife.jdbi.v2.DBI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.Scope;

/**
 *
 * @author kent
 */
@Configuration
@ImportResource({"classpath:testContext.xml"})
public class AppContext {

    @Autowired
    DataSource dataSource;

    @Bean
    public DBI dbi() {
        return new DBI(dataSource);
    }

    @Bean(destroyMethod = "close")
    @Scope(value = "prototype")
    public Dao dao() {
        return dbi().open(Dao.class);
    }
}
